#ifndef __SPELL_H__
#define __SPELL_H__

#include "cocos2d.h"
#include "Unit.h"

USING_NS_CC;

struct LeftButton
{
	float X = 0;
	float Y = 0;
};
struct LeftTop
{
	float X = 0;
	float Y = 0;
};
struct RightButton
{
	float X = 0;
	float Y = 0;
};
struct RightTop
{
	float X = 0;
	float Y = 0;
};

class Spell : public CCSprite
{
public:
	Spell(Unit* Holder, int id);
	~Spell();

	void ReleaseSpell();
	//void _ReleaseSpell();
	void DealSpellDamage();
	virtual void update(float diff);
	float GetAttackTime()		{ return AttackTimer; }
	void SetAttackTime(float t)	{ AttackTimer = t; }
	float GetAttackMovingPos()	{ return AttackMovingPos; }
private:
	float AttackTimer;
	float AttackMovingPos;
	float MaxAttackRangeX;
	float MaxAttackRangeY;
	std::vector<CCSprite*> Targets;
	void CalcAttackRange();
	void FillTargetMap();
	bool IsInSpellRange(CCSprite* Checked);
	Rect m_CheckRange_Box;
	Unit* m_Holder;
};


#endif